package mypazar.jenamodel;

import com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntModelSpec;
import com.hp.hpl.jena.ontology.OntProperty;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.vocabulary.XSD;

public class PazarRDFS {
	private static final String NS = "http://example.com/RDFS/";
	private static final String PAZAR_CLASS_URI = NS + "pazar";
	private static final String PERSON_CLASS_URI = NS + "person";
	private static final String SALESMAN_CLASS_URI = NS + "salesman";
	private static final String POSITION_CLASS_URI = NS + "position";
	private static final String STALL_CLASS_URI = NS + "stall";
	private static final String RECEIVED_PRICE_CLASS_URI = NS + "received";
	private static final String SALESMAN_PRODUCT_CLASS_URI = NS
			+ "salesmanproduct";
	private static final String PERSON_PRODUCT_CLASS_URI = NS + "personproduct";
	private static final String PERSON_POS_X_URI = "http://example.com/p/posx";
	private static final String PERSON_POS_Y_URI = "http://example.com/p/posy";
	private static final String STALL_POS_X_URI = "http://example.com/p/stallposx";
	private static final String STALL_POS_Y_URI = "http://example.com/p/stallposy";
	private static final String PAZAR_PERSON_URI = "http://example.com/p/pazarperson";
	private static final String PAZAR_SALESMAN_URI = "http://example.com/p/pazarsalesman";
	private static final String PERSON_BULUNUR_URI = "http://example.com/p/personbulunur";
	private static final String STALL_BULUNUR_URI = "http://example.com/p/stallbulunur";
	private static final String PERSON_AD_URI = "http://example.com/p/personad";
	private static final String RECEIVED_BULUNUR_URI = "http://example.com/p/receivedbulunur";
	private static final String PRICE_PROP_URI = "http://example.com/p/priceolur";
	private static final String QUANTITY_OLUR_URI = "http://example.com/p/productbulunur";
	private static final String PRODUCT_BULUNUR_URI = "http://example.com/p/quantityolur";

	public static final Resource PAZAR_CLASS = ResourceFactory
			.createResource(PAZAR_CLASS_URI);
	public static final Resource PERSON_CLASS = ResourceFactory
			.createResource(PERSON_CLASS_URI);
	public static final Resource SALESMAN_CLASS = ResourceFactory
			.createResource(SALESMAN_CLASS_URI);
	public static final Resource POSITION_CLASS = ResourceFactory
			.createResource(POSITION_CLASS_URI);
	public static final Resource STALL_CLASS = ResourceFactory
			.createResource(STALL_CLASS_URI);
	public static final Resource RECEIVED_PRICE_CLASS = ResourceFactory
			.createResource(RECEIVED_PRICE_CLASS_URI);
	public static final Resource SALESMAN_PRODUCT_CLASS = ResourceFactory
			.createResource(SALESMAN_PRODUCT_CLASS_URI);
	public static final Resource PERSON_PRODUCT_CLASS = ResourceFactory
			.createResource(PERSON_PRODUCT_CLASS_URI);

	public void createRDFS() {

		OntModel pazarRDFS = ModelFactory
				.createOntologyModel(OntModelSpec.RDFS_MEM);

		OntClass pazar = pazarRDFS.createClass(PAZAR_CLASS_URI);

		OntClass person = pazarRDFS.createClass(PERSON_CLASS_URI);

		OntClass salesman = pazarRDFS.createClass(SALESMAN_CLASS_URI);

		OntClass position = pazarRDFS.createClass(POSITION_CLASS_URI);

		OntClass salesmanproduct = pazarRDFS
				.createClass(SALESMAN_PRODUCT_CLASS_URI);

		OntClass personproduct = pazarRDFS
				.createClass(PERSON_PRODUCT_CLASS_URI);

		OntClass received = pazarRDFS.createClass(RECEIVED_PRICE_CLASS_URI);

		OntClass stall = pazarRDFS.createClass(STALL_CLASS_URI);

		// Pazar Person Property
		OntProperty pazarPersonProp = pazarRDFS
				.createOntProperty(PAZAR_PERSON_URI);
		pazarPersonProp.addRange(person);
		pazarPersonProp.addDomain(pazar);

		// Pazar Salesman Property
		OntProperty pazarSalesmanProp = pazarRDFS
				.createOntProperty(PAZAR_SALESMAN_URI);
		pazarSalesmanProp.addRange(salesman);
		pazarSalesmanProp.addDomain(pazar);

		// Person Bulunur Property
		OntProperty personBulunurProp = pazarRDFS
				.createOntProperty(PERSON_BULUNUR_URI);
		personBulunurProp.addRange(position);
		personBulunurProp.addDomain(person);

		// Person Ad Property
		OntProperty personAdProp = pazarRDFS.createOntProperty(PERSON_AD_URI);
		personAdProp.addRange(XSD.xstring);
		personAdProp.addDomain(person);

		// Position's X and Y Property
		OntProperty posXProp = pazarRDFS.createOntProperty(PERSON_POS_X_URI);
		posXProp.addRange(XSD.integer);
		posXProp.addDomain(position);

		OntProperty posYProp = pazarRDFS.createOntProperty(PERSON_POS_Y_URI);
		posYProp.addRange(XSD.integer);
		posYProp.addDomain(position);

		// Person Bulunur Property
		OntProperty stallBulunurProp = pazarRDFS
				.createOntProperty(STALL_BULUNUR_URI);
		stallBulunurProp.addRange(stall);
		stallBulunurProp.addDomain(person);

		// Stall Position's X and Y Property
		OntProperty stallPosXProp = pazarRDFS
				.createOntProperty(STALL_POS_X_URI);
		stallPosXProp.addRange(XSD.integer);
		stallPosXProp.addDomain(stall);

		OntProperty stallPosYProp = pazarRDFS
				.createOntProperty(STALL_POS_Y_URI);
		stallPosYProp.addRange(XSD.integer);
		stallPosYProp.addDomain(stall);

		// Received bulunur Prop
		OntProperty receivedBulunurProp = pazarRDFS
				.createOntProperty(RECEIVED_BULUNUR_URI);
		receivedBulunurProp.addRange(received);
		receivedBulunurProp.addDomain(person);

		// Price olur Prop
		OntProperty priceOlurProp = pazarRDFS.createOntProperty(PRICE_PROP_URI);
		priceOlurProp.addRange(XSD.integer);
		priceOlurProp.addDomain(received);

		// Product Bulunur Prop
		OntProperty productBulunur = pazarRDFS
				.createOntProperty(PRODUCT_BULUNUR_URI);
		productBulunur.addRange(XSD.xstring);
		productBulunur.addDomain(salesmanproduct);

		// Quantity Olur Prop
		OntProperty quantityOlur = pazarRDFS
				.createOntProperty(QUANTITY_OLUR_URI);
		quantityOlur.addRange(XSD.integer);
		quantityOlur.addDomain(salesmanproduct);

		// Product Bulunur Prop
		OntProperty personProductBulunur = pazarRDFS
				.createOntProperty(PRODUCT_BULUNUR_URI);
		personProductBulunur.addRange(XSD.xstring);
		personProductBulunur.addDomain(personproduct);

		// Quantity Olur Prop
		OntProperty personQuantityOlur = pazarRDFS
				.createOntProperty(QUANTITY_OLUR_URI);
		personQuantityOlur.addRange(XSD.integer);
		personQuantityOlur.addDomain(personproduct);
	}
}